package common

import (
	"github.com/mojocn/base64Captcha"
	"github.com/astaxie/beego"
)

type CaptchaController struct {
	beego.Controller
}


func (this *CaptchaController) Get()  {
	var configD = base64Captcha.ConfigDigit{
		Height:     44,
		Width:      120,
		MaxSkew:    0.5,
		DotCount:   60,
		CaptchaLen: 5,
	}
	idKeyD, capD := base64Captcha.GenerateCaptcha("", configD)
	//以base64编码
	base64stringD := base64Captcha.CaptchaWriteToBase64Encoding(capD)
	data := map[string]interface{}{
		"key":idKeyD,
		"captcha":base64stringD,
	}
	this.Data["json"] = data
	this.ServeJSON()
}